package com.ddd.mill.api.attribute;

import com.ddd.mill.query.attribute.AttributeQueryService;
import com.ddd.mill.query.attributevalue.AttributeValueQueryService;
import com.ddd.mill.api.attribute.dto.response.AttributeListDto;
import com.ddd.mill.api.attribute.dto.response.response.AttributeValueListDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.List;

/**
 * @author liu
 * @title: AttributeController
 * @projectName trading-center
 * @date 2020/11/3014:21
 */
@Api(tags = "属性接口")
@Slf4j
@RestController
public class AttributeController {

    @Autowired
    AttributeQueryService attributeQueryService;

    @Autowired
    AttributeValueQueryService attributeValueQueryService;

    @ApiOperation("属性列表")
    @GetMapping("/admin/get/{attributeTypeId}/attribute-list")
    public List<AttributeListDto> getAttributeInfo(@ApiParam("属性类别id")@PathVariable Long attributeTypeId){
        return attributeQueryService.getAttributeList(attributeTypeId);
    }

    @ApiOperation("属性值列表")
    @GetMapping("/admin/get/attribute/{attributeId}/valueList")
    public List<AttributeValueListDto> attributeValueList(@ApiParam("属性ID") @PathVariable Long attributeId){
        return attributeValueQueryService.attributeValueList(attributeId);
    }

}
